package second.group.bering.parking_system

import second.group.bering.parking_system.model.Car;
/**
 *
 * SuperParkingBoy
 *
 * @author Burgess Li
 * @date 8/24/2018 2:18 PM
 * @version 1.0
 *
 */
class SuperParkingBoy extends ParkingBoy {

    String parking(Car car) {
        if (car && parks.values().every { !it.exists(car) } && parks.values().any { it.hasLocation() }) {
            Park park = parks.values().max { it.availableLocation() / it.size }
            park.parking(car)
            return park.id
        }
        return null
    }

}
